import { createBrowserRouter, Navigate } from 'react-router-dom'
import Home from '../views/Home'
import Detail from "../views/Detail"
import Cart from "../views/Cart"
import Todo from "../views/Todo"
const router = createBrowserRouter([
  {
    path: "/",
    element: <Navigate to='/home'></Navigate>,
  },
  {
    path: "/home",
    element: <Home></Home>,
    children: [
      {
        path: "Cart",
        element: <Cart></Cart>,
        children: [
          {
            path: "Detail",
            element: <Detail></Detail>,
            handle: {
              title: "详情页",
            }
          },
        ],
        handle: {
          title: "购物车",
        }
      },
    ],
    handle: {
      title: "首页",
    }
  },
  {
    path: "/todo",
    element: <Todo></Todo>,
  },
])

export default router